package org.pada.client.exception;

import lombok.Getter;

/**
 * @author pengshen
 * @date 2022.03.22 8:50 下午
 */
@Getter
public abstract class BaseException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    private final String errCode;
    private final String errMsg;

    public BaseException(String errCode, String errMsg) {
        super(errMsg);
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    public BaseException(String errCode, String errMsg, Throwable e) {
        super(errMsg, e);
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    public BaseException(ErrorCode errorCode) {
        this(errorCode.getErrCode(), errorCode.getErrMsg());
    }

    public BaseException(ErrorCode errorCode, Throwable e) {
        this(errorCode.getErrCode(), errorCode.getErrMsg(), e);
    }
}
